CROSS = arm-none-linux-gnueabi
CC = $(CROSS)-gcc
AR = $(CROSS)-ar

CFLAGS = -shared -fPIC 

CPPFLAGS := -I ../include

OBJ := ts.o lcd.o common.o 
SRCPIC := $(wildcard load/*.c)
OBJPIC := $(SRCPIC:%.c=%.o)

all:libcommon.so libpic.so
	cp $^ ../lib

libcommon.so:$(OBJ)
	$(CC) $(CFLAGS) -o $@ $^ -L ../lib -ljpeg -lapi_v4l2_arm

libpic.so:$(OBJPIC)
	$(CC) $(CFLAGS) -o $@ $^

$(OBJ):%.o:%.c
	$(CC) $< -o $@ $(CPPFLAGS) -c

$(OBJPIC):%.o:%.c
	$(CC) $< -o $@ -c

clean:
	$(RM) *.o load/*.o *.so
